home *** CD-ROM | disk | FTP | other *** search
- sgidladd(3c) Last changed: 1-8-99
-
-
- NNAAMMEE
- ssggiiddllaadddd - Opens a shared object and adds its variables to the name
- space.
-
- SSYYNNOOPPSSIISS
- cccc [_f_l_a_g ...] _f_i_l_e ... --llcc [_l_i_b_r_a_r_y ...]
-
- ##iinncclluuddee <<ddllffccnn..hh>>
-
- vvooiidd **ssggiiddllaadddd((ccoonnsstt cchhaarr **_p_a_t_h_n_a_m_e,, iinntt _m_o_d_e);
-
- IIMMPPLLEEMMEENNTTAATTIIOONN
- IRIX systems
-
- DDEESSCCRRIIPPTTIIOONN
- ssggiiddllaadddd is a facility for dynamically loading shared objects. Unlike
- ddllooppeenn(3) (without RRTTLLDD__GGLLOOBBAALL), the loaded shared object and all
- associated dependent shared objects are added to the list of shared
- objects just as if they had been specified at the time the program was
- linked, or as if the __RRLLDD__LLIISSTT (see rrlldd(1)) environment variable had
- been used. That is to say, all of the names in the shared object
- become available to satisfy references in shared objects during lazy
- text resolution. The DSOs are globally visible (see also the
- "Namespace Issues" section in the ddllooppeenn(3c) man page).
-
- _m_o_d_e can be any one of RRTTLLDD__LLAAZZYY, RRTTLLDD__NNOOWW, or RRTTLLDD__NNOOWW__RREEPPOORRTT__EERRRROORR.
-
- RRTTLLDD__NNOOWW mode does exactly the same thing as RRTTLLDD__LLAAZZYY. When the mode
- is specified as RRTTLLDD__LLAAZZYY or RRTTLLDD__NNOOWW, resolution of all symbols is
- performed, so that references that were previously unbound or bound to
- weak symbols can be rebound to strong symbols. However, unresolvable
- function references (references to symbols that do not exist in any
- shared object or in the mainline) are left dangling for further "lazy"
- resolution, (possibly pending another call to ssggiiddllaadddd).
-
- When the mode is specified as RRTTLLDD__NNOOWW__RREEPPOORRTT__EERRRROORR, resolution of all
- symbols is performed, and any unresolvable reference results in an
- error return from ssggiiddllaadddd. In this case, because resolution was not
- completed, it is very dangerous to continue execution. The main use
- for this function is to ensure that at the point of ssggiiddllaadddd
- execution, all symbols have been resolved. This facility is useful for
- verifying completeness of interfaces.
-
- As with ddllooppeenn, a handle to the added object is returned. This handle
- can be used to obtain addresses of specific symbols within the added
- object. This is somewhat less useful than with ddllooppeenn (without
- RRTTLLDD__GGLLOOBBAALL), since in the case of ssggiiddllaadddd, rrlldd can resolve these
- symbols directly (as can ddllooppeenn with RRTTLLDD__GGLLOOBBAALL).
-
- ssggiiddllaadddd is available in a library that is loaded if the --llcc option is
- used with cccc, ff7777, or lldd.
-
- SSeeaarrcchhiinngg ffoorr SShhaarreedd OObbjjeeccttss
- If other shared objects were link edited with _p_a_t_h_n_a_m_e when _p_a_t_h_n_a_m_e
- was built, ddllooppeenn automatically loads those objects. The directory
- search path used to find both _p_a_t_h_n_a_m_e and the other needed objects is
- the same as that used by rrlldd(1). In particular, the search for
- _p_a_t_h_n_a_m_e occurs in the following locations in the following order:
-
- 1. The directory that _p_a_t_h_n_a_m_e specified if it is not a simple file
- name (that is, it contains a // character). In this case, the exact
- file is the only location searched; steps two through four are
- ignored.
-
- 2. Any path specified by the --rrppaatthh argument to lldd(1) when the
- executable file was statically linked.
-
- 3. Any directory specified by the LLDD__LLIIBBRRAARRYY__PPAATTHH environment
- variable. This environment variable should contain a colon-
- separated list of directories, in the same format as the PPAATTHH
- variable (see sshh(1)). 64-bit programs examine the
- LLDD__LLIIBBRRAARRYY6644__PPAATTHH variable, and if it is not set, they examine
- LLDD__LLIIBBRRAARRYY__PPAATTHH. New 32-bit ABI programs examine the
- LLDD__LLIIBBRRAARRYYNN3322__PPAATTHH variable, and if it is not set, they examine
- LLDD__LLIIBBRRAARRYY__PPAATTHH to determine whether an ABI-specific path has been
- specified.
- All three of these variables are ignored if the process is running
- sseettuuiidd or sseettggiidd (see eexxeecc(2)).
-
- 4. The default search paths are used. These are //uussrr//lliibb:://lliibb for
- 32-bit programs, //uussrr//lliibb6644:://lliibb6644 for 64-bit programs, and
- //uussrr//lliibb3322:://lliibb3322 for new 32-bit ABI programs.
-
- The __RRLLDD__RROOOOTT variable has its usual effect, as documented in the
- manpage for rrlldd(1) (which means that for a sseettuuiidd or sseettggiidd program,
- __RRLLDD__RROOOOTT is ignored).
-
- You can use ssggiiddllaadddd to open any number of times objects whose names
- resolve to the same absolute or relative path name. However, the
- referenced object is loaded only once into the address space of the
- current process. The same object referenced by two different path
- names, however, can be loaded multiple times. For example, given the
- object //uussrr//hhoommee//mmee//mmyylliibbss//mmyylliibb..ssoo, and assuming the current working
- directory is //uussrr//hhoommee//mmee//wwoorrkkddiirr, the following code results in
- mmyylliibb..ssoo being loaded twice for the current process:
-
- ...
- void *handle1;
- void *handle2;
-
- handle1 = sgidladd("../mylibs/mylib.so", RTLD_LAZY);
- handle2 = sgidladd("/usr/home/me/mylibs/mylib.so", RTLD_LAZY);
- ...
-
- On the other hand, given the same object and current working
- directory, if you set LLDD__LLIIBBRRAARRYY__PPAATTHH equal to //uussrr//hhoommee//mmee//mmyylliibbss,
- the following code results in mmyylliibb..ssoo being loaded only once.
-
- ...
- void *handle1;
- void *handle2;
-
- handle1 = sgidladd("mylib.so", RTLD_LAZY);
- handle2 = sgidladd("/usr/home/me/mylibs/mylib.so", RTLD_LAZY);
- ...
-
- NNOOTTEESS
- Use of ddllcclloossee on a DSO that has been added through use of ssggiiddllaadddd
- can cause surprising side effects because ddllcclloossee forces many symbol's
- GOT entries to be reset for re-lazy-evaluation. A result of this is
- that previously-saved (by the application or some library) function
- pointers might hold values that could be obsolete or no longer
- correct.
-
- Symbol lookups proceed in order on a linear list, and a DSO is not
- opened twice with the same version number (unless different ddllooppeenn
- paths make the DSO name appear different to _r_l_d). When multiple
- ssggiiddllaadddd commands are executed and an earlier DSO is closed by
- ddllcclloossee, this can change the symbol to which a call is resolved. For
- more information, see the "Namespace Issues" section in the ddllooppeenn(3c)
- man page.
-
- RREETTUURRNN VVAALLUUEESS
- If _p_a_t_h_n_a_m_e cannot be found, cannot be opened for reading, or is not a
- shared object, or if an error occurs during the process of loading
- _p_a_t_h_n_a_m_e or relocating its symbolic references, ssggiiddllaadddd returns NNUULLLL.
- More detailed diagnostic information is available through the
- ddlleerrrroorr(3c) man page.
-
- SSEEEE AALLSSOO
- ddllooppeenn(3) ddlleerrrroorr(3), ddllcclloossee(3), ddllssyymm(3), ssggiiddllooppeenn__vveerrssiioonn(3),
- rrlldd(1), ddssoo(5)
-
- This man page is available only online.
-